#include<iostream>
#include<fcntl.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>

using namespace std;

int main()
{
    int fd=open("bite.txt",O_RDWR|O_CREAT,0664);
    if(-1==fd)
    {
        perror("open");
        exit(-1);
    }
    char buf1[]="i like linux\n";
    write(fd,buf1,sizeof(buf1));
    lseek(fd,0,SEEK_SET);
    char buf2[30];
    read(fd,buf2,sizeof(buf2));
    printf("%s",buf2);
    close(fd);

    return 0;
}